<template>
  <div class="wrap-box">
    <div class="login-box">
      <div class="title-box">
        <img src="~@/assets/images/login_logo.png" alt="" />
        <span>视联网存储服务系统</span>
      </div>
      <div class="login-content">
        <div class="input-box" style="margin-top: 45px">
          <el-input placeholder="请输入账号" v-model="account">
            <i slot="prefix" class="el-input__icon el-icon-user"></i>
          </el-input>
        </div>
        <div class="input-box">
          <el-input placeholder="请输入密码" v-model="password">
            <i slot="prefix" class="el-input__icon el-icon-solid"></i>
          </el-input>
        </div>
        <div class="input-box">
          <el-input placeholder="请输入验证码" v-model="code">
            <i slot="prefix" class="el-input__icon el-icon-s-check"></i>
          </el-input>
          <img
            class="qrCode"
            id="pictureCode"
            src="/cms/Picture/image/pictureCheckCode.do"
            alt=""
            @click="changeCode"
          />
        </div>
        <div class="log" @click="loginCms">登录</div>
      </div>
    </div>
    <!-- 登录成功弹框 -->
    <el-dialog
      :visible.sync="loginTrue"
      width="850px"
      top="35vh"
      custom-class="login-title"
      :show-close="false"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
    >
      <div class="confirm-box">
        <div class="sName">
          <img
            src="~@/assets/images/loginImg/login_success.png"
            alt=""
          />登录成功
        </div>
        <div class="tipN">密码有效期截至{{ upToTime }}过期将不允许登录</div>
      </div>
      <div slot="footer">
        <button @click="submitLogin">确定</button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import "@/assets/css/login.less";
import Cookie from "js-cookie";
export default {
  name: "login",
  data() {
    return {
      account: "",
      password: "",
      code: "",
      loginTrue: false, //登录确认弹框
      upToTime: "2021-10-27 18:40:14",
    };
  },
  components: {},
  methods: {
    changeCode() {
      document.getElementById("pictureCode").src =
        "/cms/Picture/image/pictureCheckCode.do?" + Math.random();
    },
    //登录
    loginCms() {
      // Cookie.set("userInfo", "66666666");
      // this.$router.push("/");
      this.loginTrue = true;
    },
    submitLogin() {
      Cookie.set("userInfo", "66666666");
      this.$router.push("/");
    },
  },
};
</script>

<style lang="less">
.wrap-box {
  .el-input {
    margin-top: 10px;
  }
  .el-input--prefix .el-input__inner {
    padding-left: 65px;
  }
  .el-input__prefix,
  .el-input__suffix {
    top: auto;
    right: auto;
  }
  .el-input__inner {
    background-color: transparent;
    border: none;
    height: 40px;
    font-size: 19px;
    color: #cfe2fd;
    &:hover {
      border: none;
    }
    &::placeholder {
      color: #9eabbe !important;
    }
    &:focus {
      -webkit-text-fill-color: #cfe2fd;
    }
  }
  // 图标
  .el-input__icon {
    vertical-align: middle;
    margin-left: 25px;
  }
  .el-icon-user {
    background: url("~@/assets/images/loginImg/ico_user.png") no-repeat center
      center;
    background-size: 22px;
    &::before {
      content: "";
    }
  }
  .el-icon-solid {
    background: url("~@/assets/images/loginImg/ico_password.png") no-repeat
      center center;
    background-size: 22px;
    &::before {
      content: "";
    }
  }
  .el-icon-s-check {
    background: url("~@/assets/images/loginImg/ico_code.png") no-repeat center
      center;
    background-size: 20px;
    &::before {
      content: "";
    }
  }
  // 登录确认弹框
  .login-title {
    .el-dialog__footer,
    .el-dialog__header,
    .el-dialog__body {
      background-color: #000521;
    }
  }
}
</style>
<style lang="less" scoped>
.login-title {
  .confirm-box {
    text-align: center;
    color: #fff;
    .sName {
      font-size: 18px;
      height: 65px;
      line-height: 65px;
      img {
        vertical-align: middle;
        margin-right: 15px;
      }
    }
    .tipN {
      font-size: 15px;
      height: 65px;
      line-height: 65px;
    }
  }
  button {
    color: #fff;
    font-size: 15px;
    width: 150px;
    height: 0.38rem;
    background-color: #4a69a4;
    border: none;
    cursor: pointer;
  }
}
</style>
